design_matrix Function

public pure function design_matrix(order, intercept, x) result(c)

Computes the design matrix for the linear least-squares regression problem of , where is the matrix computed here, is the vector of coefficients to be determined, and is the vector of measured dependent variables.

See Also

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: order

The order of the equation to fit. This value must be at least one (linear equation), but can be higher as desired.

logical, intent(in) :: intercept

Set to true if the intercept is being computed as part of the regression; else, false.

real(kind=real64), intent(in) :: x(:)

An N-element array containing the independent variable measurement points.

Return Value real(kind=real64), allocatable, (:,:)

An N-by-K matrix where the results will be written. K must equal order + 1 in the event intercept is true; however, if intercept is false, K must equal order.